home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
YLIB
/
ylib_0_10
/
s
/
ylib_mod
< prev
next >
Wrap
Text File
|
1993-09-21
|
7KB
|
356 lines
;
; Copyright (C) 1993 Claus Vohwinkel
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License , or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; see the file COPYING. If not, write to
; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;
; You may contact the author by:
; e-mail: vohwinkel@vxdesy.desy.de
; us-mail: Claus Vohwinkel
; SCRI/FSU
; 400 Science Library
; Tallahassee, FL 32306
;
;
R0 RN 0
R1 RN 1
R2 RN 2
R3 RN 3
R4 RN 4
R5 RN 5
R6 RN 6
R7 RN 7
R8 RN 8
R9 RN 9
R10 RN 10
R11 RN 11
IP RN 12
SP RN 13
R14 RN 14
PC RN 15
F0 FN 0
F1 FN 1
F2 FN 2
F3 FN 3
OVERFLOW * &10000000
BASE_ID * &80680
;BASE_ID * &C0340 ; FOR TEST ONLY
XOS_WRITEI * &20100
XOS_WRITE0 * &20002
XOS_NEWLINE * &20003
XOS_READARGS * &20049
XOS_MODULE * &2001E
ORG &8000
MODHEAD & 0
& MODINIT - MODHEAD
& MODFIN - MODHEAD
& 0
& MODTITLE - MODHEAD
& MODHELP - MODHEAD
& MODCOM - MODHEAD
& BASE_ID
& SWICODE - MODHEAD
& SWIDECODE - MODHEAD
& -1
MODTITLE = "FastMath",0
ALIGN
MODHELP = "FastMath",9,"0.10 (20 Sep 1993)",0
ALIGN
MODCOM = "FastMath",0
ALIGN
& FMC - MODHEAD
& &00020000
& SYNTAX - MODHEAD
& SHELP - MODHEAD
& 0
SHELP = "FastMath [-on|-off] [-verbose] determines wheter the usual CLib",&D
= "routines or the faster routines are used. If -verbose is specified",&D
= "a message will be printed when a program is linked with the faster",&D
= "routines. This is for debugging only and should not be used when",&D
= "starting up Wimp applications.",&D,0
ALIGN
SWIDECODE = "SharedCLibrary",0
= "LibInitAPCS_A",0
= "LibInitAPCS_R",0
ALIGN
& 0
^ 0,IP
R7S # 4 ; R7S - SPS MUST BE FIRST
R8S # 4
R9S # 4
SPS # 4
ACTIVE # 4
CLSWI # 4
CLBASE # 4
CLPRIV # 4
VERB # 4
OFF # 4
TRSTR # 24
BASEEND # 0
MODFIN LDR IP,[IP]
LDR R1,ACTIVE
TEQ R1,#0
MOVEQ PC,R14
ADR R0,ERROR1BLOCK
TEQP PC,#&10000003
MOV PC,R14
MODINIT STMFD SP!,{R14}
RFS R0
AND R0,R0,#&FF000000
TEQ R0,#&81000000
BNE MODIE3
TEQ R11,#0
BNE MODIE ; new instantation not allowed
LDR R2,[IP]
TEQ R2,#0
BNE MODI1 ; WE HAVE ALREADY WORKSPACE
MOV R0,#6
MOV R3,#BASEEND - R7S
SWI XOS_MODULE
BVS MODIE1
STR R2,[IP]
MODI1 MOV IP,R2
MOV R0,#0
STR R0,ACTIVE
STR R0,OFF
STR R0,VERB
LDMFD SP!,{PC}
MODIE TEQP PC,#&10000003
MODIE1 ADR R0,ERRORBLOCK
LDMFD SP!,{PC}
MODIE3 ADR R0,ERX5T
LDMFD SP!,{R14}
ORRS PC,R14,#OVERFLOW
ERX5T & BASE_ID+63
= "You don't have an FPA10",0
ALIGN
FMC STMFD SP!,{R14}
LDR IP,[IP]
TEQ R1,#0
BEQ FMC5
MOV R1,R0
ADR R0,PARSE
ADR R2,TRSTR
MOV R3,#BASEEND - TRSTR
SWI XOS_READARGS
BVS FMCE
LDR R0,[R2]
LDR R1,[R2,#4]
TEQ R1,#0
MOVNE R1,#-1
TST R0,R1
BNE FMCE
TEQ R1,#0
STRNE R1,OFF
TEQ R0,#0
STRNE R1,OFF
ORR R0,R0,R1
LDR R1,[R2,#8]
STR R1,VERB
ORRS R0,R0,R1
LDMNEFD SP!,{PC}^
FMC5 ADR R0,ST01
SWI XOS_WRITE0
LDR R0,OFF
TEQ R0,#0
ADRNE R0,SOFF
ADREQ R0,SON
SWI XOS_WRITE0
LDR R0,VERB
TEQ R0,#0
ADRNE R0,ST02
SWINE XOS_WRITE0
SWI XOS_WRITEI + "."
SWI XOS_NEWLINE
LDMFD SP!,{PC}^
FMCE ADR R0,SYNBL
FMCE1 LDMFD SP!,{R14}
ORRS PC,R14,#OVERFLOW
ST01 = " FastMath is ",0
ST02 = " and in verbose mode",0
SYNBL & BASE_ID+63
SYNTAX = "Syntax : FastMath [-on|-off] [-verbose]",0
ALIGN
PARSE = "on/s,off/s,verbose/s",0
ALIGN
SOFF = "off",0
SON = "on",0
ALIGN
SWICODE LDR IP,[IP]
STMFD SP!,{R0-R5,R14}
MOV R0,#18
ADR R1,CLTITLE
SWI XOS_MODULE
BVS SWEX
STR R3,CLBASE
STR R4,CLPRIV
LDR R2,[R3,#32]
ADD R2,R2,R3
STR R2,CLSWI
LDMFD SP!,{R0-R5,R14}
LDR R10,OFF
TEQ R10,#0
LDR R10,CLSWI
TEQEQ R11,#1 ; R BINDING ?
ADRNE IP,CLPRIV
MOVNE PC,R10 ; NO -> DON'T ALTER
STMIA IP,{R7-R9}
MOV R7,R0
MOV R8,#0
SWIC1 LDR R9,[R7],#20
CMP R9,#-1
BEQ SWIC2
TEQ R9,#1
TEQEQ R8,#0
MOVEQ R8,#1
TEQ R9,#2
TEQEQ R8,#1
MOVEQ R8,#2
STREQ R7,SPS
B SWIC1
SWIC2 TEQ R8,#2
LDMNEIA IP,{R7-R9}
ADRNE IP,CLPRIV
MOVNE PC,R10
LDR R7,SPS
LDR R8,[R7,#-16]
LDR R9,[R7,#-12]
SUB R7,R9,R8
CMP R7,#732
LDMLTIA IP,{R7-R9}
ADRLT IP,CLPRIV
MOVLT PC,R10
STR R14,SPS
ADR R7,SWIC3
AND R14,R14,#&FC000000
ORR R14,R14,#3
ORR R14,R14,R7 ; set return adress and caller flags
MOV R7,IP ; save my own private word
ADR IP,CLPRIV
MOV PC,R10
SWIC3 MOV IP,R7 ; restore private word
BVS SWICV ; did we get an error ?
ADD R7,R8,#528 ; vector for acos
ADR R8,BRTAB
SUB R10,R8,R7
MOV R10,R10,LSR #2
SWIC4 LDR R9,[R8]
CMP R9,#-1
BEQ SWIC6
TEQ R9,#0
BEQ SWIC5
ADD R9,R9,R10
BIC R9,R9,#&FF000000
ORR R9,R9,#&EA000000
STR R9,[R7]
SWIC5 ADD R7,R7,#4
ADD R8,R8,#4
B SWIC4
SWIC6 MOV R7,#1
STR R7,ACTIVE
LDR R7,VERB
TEQ R7,#0
BEQ SWIC7
MOV R7,R0
ADR R0,ST03
SWI XOS_WRITE0
MOV R0,R7
SWI XOS_NEWLINE
SWIC7 LDMIA IP,{R7-R9,R14}
MOVS PC,R14
SWICV LDMIA IP,{R7-R9,R14}
ORRS PC,R14,#OVERFLOW
SWEX ADR R0,ERROR2BLOCK
LDMFD SP!,{R0-R5,R14}
ORRS PC,R14,#OVERFLOW
ST03 = " FastMath is linked into current application",&D,0
ALIGN
CLTITLE = "SharedCLibrary",0
ALIGN
ERRORBLOCK & BASE_ID+63
= " error during module initialisation",0
ALIGN
ERROR2BLOCK & BASE_ID+63
= " could not find Shared CLibrary",0
ALIGN
ERROR1BLOCK & BASE_ID+63
= " module is linked to applications",0
ALIGN
; -1 is end of table
; 0 means don't overwrite SharedCLib vector
BRTAB B yacos
B yasin
B yatan
B yatan2
B ycos
B ysin
B ytan
B ycosh
B ysinh
B ytanh
B yexp
& 0 ; frexp
& 0 ; ldexp
B ylog
B ylog10
B ymodf
B ypow
B ysqrt
B yceil
& 0 ; fabs
B yfloor
B yfmod
& -1
GET YLIB
END